package ru.usu.gv.gui.actions;

import ru.usu.gv.core.GraphCanvas;
import ru.usu.gv.styles.StyleConstants;
import ru.usu.gv.styles.StyleFacade;
import ru.usu.gv.uicomponents.UIEdge;
import ru.usu.gv.uicomponents.UIGraph;

/**
 * @author spupyrev
 * 02.11.2008
 */
public class ShowEdgesAction extends ActionBase
{
	private boolean showEdges;

	public ShowEdgesAction(boolean showEdges)
	{
		this.showEdges = showEdges;
	}

	@Override
	public void execute()
	{
		StyleFacade.getCurrentStyle().setBooleanAttribute(StyleConstants.EDGE_SHOW_ATTRIBUTE, showEdges);

		UIGraph currentGraph = GraphCanvas.getInstance().getCurrentGraph();
		for (UIEdge edge : currentGraph.getEdges())
		{
			if (showEdges)
				edge.show();
			else
				edge.hide();
		}
	}

}
